﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;

namespace ResourceBlender.Core {
    public class ResxResource : INotifyPropertyChanged {
        private string name = string.Empty,
                       translation = string.Empty,
                       comment = string.Empty,
                       type = string.Empty,
                       mimeType = string.Empty;

        /// <summary>
        /// Gets or sets the name of this resource.
        /// </summary>
        /// <value>The name.</value>
        public string Name {
            get { return name; }
            set {
                name = value;
                OnPropertyChanged("Name");
            }
        }

        /// <summary>
        /// Gets or sets the translation (value) of this resource.
        /// </summary>
        /// <value>The value/translation.</value>
        public string Translation {
            get { return translation; }
            set {
                translation = value;
                OnPropertyChanged("Translation");
            }
        }

        /// <summary>
        /// Gets or sets the comment for this resource.
        /// </summary>
        /// <value>The comment.</value>
        public string Comment {
            get { return comment; }
            set {
                comment = value;
                OnPropertyChanged("Comment");
            }
        }

        /// <summary>
        /// Gets or sets the type of this resource.
        /// </summary>
        /// <value>The type.</value>
        public string Type {
            get { return type; }
            set {
                type = value;
                OnPropertyChanged("Type");
            }
        }

        /// <summary>
        /// Gets or sets mime type comment for this resource.
        /// </summary>
        /// <value>The comment.</value>
        public string MimeType {
            get { return mimeType; }
            set {
                mimeType = value;
                OnPropertyChanged("MimeType");
            }
        }

        public ResxResource() { }

        /// <summary>
        /// Initializes a new <see cref="ResxResource"/>.
        /// </summary>
        /// <param name="name">The name.</param>
        /// <param name="translation">The translation.</param>
        /// <param name="comment">The comment.</param>
        public ResxResource(string name, string translation, string comment) {
            this.name = name;
            this.translation = translation;
            this.comment = comment;
        }

        /// <summary>
        /// Initializes a new <see cref="ResxResource"/>.
        /// </summary>
        /// <param name="name">The name.</param>
        /// <param name="translation">The translation.</param>
        /// <param name="comment">The comment.</param>
        /// <param name="type">The type.</param>
        /// <param name="mimeType">The MIME type.</param>
        public ResxResource(string name, string translation, string comment, string type, string mimeType) {
            this.name = name;
            this.translation = translation;
            this.comment = comment;
            this.type = type;
            this.mimeType = mimeType;
        }

        public event PropertyChangedEventHandler PropertyChanged;
        protected virtual void OnPropertyChanged(string strPropertyName) {
            if(PropertyChanged != null) {
                PropertyChanged(this, new PropertyChangedEventArgs(strPropertyName));
            }
        }
    }
}
